var nodemailer = require("nodemailer");

// create reusable transport method (opens pool of SMTP connections)
var smtpTransport = nodemailer.createTransport({
    service: 'QQ',
    auth: {
        user: "10463082@qq.com",
        pass: "190277zp~~"
    }
});

// setup e-mail data with unicode symbols
var mailOptions = {
    from: "张鹏 <10463082@qq.com>",
    to:"zanpen2000@163.com",
    subject:"Hello nodemailer",
    text:"nodemailer text content",
    html:"<b>nodemailer html content</b>",
    attachments:[{filename:'filename',path:'e:/sources/h1.js'}]
}

// send mail with defined transport object
smtpTransport.sendMail(mailOptions, function(error, response){
    if(error){
        console.log(error);
    }else{
        console.log("Message sent: " + response.message);
    }

    // if you don't want to use this transport object anymore, uncomment following line
    //smtpTransport.close(); // shut down the connection pool, no more messages
});